package td.pt.event;

import td.domain.Thought;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;

public class ViewTagsOnThoughtEvent extends
		GwtEvent<ViewTagsOnThoughtEvent.ViewTagsOnThoughtHandler> {

	public static Type<ViewTagsOnThoughtHandler> TYPE = new Type<ViewTagsOnThoughtHandler>();
	private Thought thought;
	private HasHandlers source;

	public interface ViewTagsOnThoughtHandler extends EventHandler {
		void onViewTagsOnThought(ViewTagsOnThoughtEvent event);
	}

	public interface ViewTagsOnThoughtHasHandlers extends HasHandlers {
		HandlerRegistration addViewTagsOnThoughtHandler(
				ViewTagsOnThoughtHandler handler);
	}

	public ViewTagsOnThoughtEvent(Thought thought, HasHandlers source) {
		this.thought = thought;
		this.source = source;
	}

	public Thought getThought() {
		return thought;
	}

	public HasHandlers getSource() {
		return source;
	}

	@Override
	protected void dispatch(ViewTagsOnThoughtHandler handler) {
		handler.onViewTagsOnThought(this);
	}

	@Override
	public Type<ViewTagsOnThoughtHandler> getAssociatedType() {
		return TYPE;
	}

	public static Type<ViewTagsOnThoughtHandler> getType() {
		return TYPE;
	}

	public static void fire(HasHandlers source, Thought thought) {
		source.fireEvent(new ViewTagsOnThoughtEvent(thought, source));
	}
}
